/*
 * @Author: ducafecat
 * @Description: 列表页
 * @Date: 2018-04-13 16:13:27
 * @Last Modified by: hans.taozhiwei
 * @Last Modified time: 2018-04-13 16:15:33
 */
import { list } from '@/api/hmmm/directorys' // 目录接口
import { list as labelLists } from '@/api/hmmm/tags' // 标签接口

const app = {
  state: {
    directoryList: {}, // 目录所有数据集合
    labelList: {} // 标签所有数据集合
  },
  mutations: {
    // 初始化目录列表数据
    modifyList (state, obj) {
      state.directoryList = obj
    },
    // 初始化标签列表数据
    modifylabelList (state, obj) {
      state.labelList = obj
    }
  },
  actions: {
    // 获取目录列表
    async getDirectoryList ({ commit }, data) {
      const obj = await list(data)
      // 调用接口,获取数据，并赋值给  directoryList
      commit('modifyList', obj)
      return obj
    },
    // 获取目录列表
    async getLabelList ({ commit }, data) {
      const obj = await labelLists(data)
      // 调用接口,获取数据，并赋值给  directoryList
      commit('modifylabelList', obj)
      return obj
    }
  }

}

export default app
